using System.Collections;
using UnityEngine;

namespace BCWAccountVip
{
	public class AccountVipUI : MonoBehaviour
	{
		public static AccountVipUI instance;

		public float waitSecondRemind = 1f;

		[SerializeField]
		private GameObject accountVipWindow;

		private void Awake()
		{
			instance = this;
			if (PlayerPrefs.GetInt("expirePlayerVipRemind") > 0 && !ManagerVip.GetInstance().HasVip())
			{
				StartCoroutine(RemindAccountVipWindowCoroutine());
			}
		}

		private void OnDestroy()
		{
			instance = null;
		}

		private IEnumerator RemindAccountVipWindowCoroutine()
		{
			yield return new WaitForSeconds(waitSecondRemind);
			RemindAccountVipWindow();
		}

		public void RemindAccountVipWindow()
		{
			accountVipWindow.SetActive(true);
			accountVipWindow.GetComponent<AccountVipWindow>().Description = "Expire VIP account";
			PlayerPrefs.SetInt("expirePlayerVipRemind", 0);
		}

		public void ShowAccountVipWindow()
		{
			accountVipWindow.SetActive(true);
		}
	}
}
